package com.spring_mysql_redis.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.spring_mysql_redis.entity.Comment;
import com.spring_mysql_redis.entity.Dynamic;
import com.spring_mysql_redis.entity.DynamicComm;
import com.spring_mysql_redis.entity.UserDynamic;
import com.spring_mysql_redis.model.ResultFormat;
import org.springframework.scheduling.annotation.Async;

import java.util.List;

public interface CommentService extends IService<Comment> {

    //根据动态id查询评论list
    public List selectCommentList(Integer dynamicId);


    public Page<DynamicComm> selectDynamicCommList(Page<DynamicComm> dynamicComm, Integer dynamicId);

    //添加评论
    ResultFormat saveComment(Comment comment);

    //删除评论
    ResultFormat deleteComment(Comment comment);

    //更新动态的评论数
    ResultFormat updateDynamicComment(Integer dynamicId);

    //删除动态后根据动态ID异步删除评论表评论
    @Async
    void delCommentList(Integer dynamicId);

}
